#include "error.h"
#include <sstream>
using namespace std;

Error::Error(const char* file, int line, const string& msg_) {
  this->file = file;
  this->line = line;
  this->msg_ = msg_;
}

string Error::msg() const {
  ostringstream m;
  m << file << ":" << line << ": " << msg_;
  return m.str();
}

void Error::print(ostream& out) const
{
  out << "Error caught, thrown from " << file << ":" << line
      << " - " << msg_
      << endl;
}
